package cj.web.activity.dao;
/*
 *  
 *  
*/
import java.util.List;

import cj.web.activity.domain.GiftSeller;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;

/**
 * 
 * @author 
 *
 */
@DAO
public interface GiftSellerDAO{
	
	@SQL("SELECT * FROM GiftSeller WHERE 1=1  AND name=:t.name, AND link=:t.link, AND orderId=:t.orderId, AND deleteFlag=:t.deleteFlag, AND createAT=:t.createAT, AND updateAT=:t.updateAT ORDER BY update_date DESC LIMIT :t.start,:t.end ")
    List<GiftSeller> query(@SQLParam("t") GiftSeller giftSeller);
    
    @SQL("select * from GiftSeller where id=:1")
    GiftSeller queryById(String id);
    
    @SQL("INSERT INTO GiftSeller (name,link,imgURL,orderId,deleteFlag,createAT,updateAT) VALUES (:t.name,:t.link,:t.imgURL,:t.orderId,:t.deleteFlag,:t.createAT,:t.updateAT)")
    void create(@SQLParam("t") GiftSeller giftSeller);
	
	@SQL("UPDATE GiftSeller SET name=:t.name,link=:t.link,imgURL=:t.imgURL,orderId=:t.orderId,updateAT=:t.updateAT WHERE id=:t.id")
    void update(@SQLParam("t") GiftSeller giftSeller);
    
    @SQL("UPDATE GiftSeller SET deleteFlag=0 WHERE id=:1")
    void deleteById(String id);
    
    @SQL("select id,name,link,orderId from GiftSeller where deleteFlag=1 #if(:t.name!=''){ and name like '%##(:t.name)%'} order by orderId limit :t.start, :t.length")
    List<GiftSeller> queryByName(@SQLParam("t")GiftSeller giftSeller);
    
    @SQL("select count(1) from GiftSeller where deleteFlag=1 #if(:t.name!=''){ and name like '%##(:t.name)%'}")
    int countByName(@SQLParam("t")GiftSeller giftSeller);
}